﻿using System;
using System.Collections;
using System.Collections.Generic;
using LogSystem;
using Pathfinding;
using Pathfinding.RVO;
using UnityEngine;
using UnityEngine.Serialization;
using RootMotion.Dynamics;

namespace Yoozoo.Gameplay.Liberty.AI
{
    public class PlayerTrigger : MonoBehaviour
    {
        private AIEntity _aiEntity;
        private AIData _aiData;
        
        public void InitData(AIEntity aiEntity)
        {
            _aiEntity = aiEntity;
            _aiData = aiEntity.data;
        }
        
        void OnTriggerEnter(Collider collider)
        {
            if (_aiEntity == null || !_aiEntity.data.isAlive)
            {
                return;
            }
            
            if (collider.CompareTag("LibertyProp"))
            {
                // 道具
                PropItem propItem = collider.GetComponent<PropItem>();
                if (propItem && !propItem.HasBeenTaken)
                {
                    propItem.OnTake(_aiEntity, gameObject);
                }
            }
        }
        
    }
}